// =============================================================================
//  STATS - Statistical Analysis Tools, v.0.01
//  Copyright (C) 2011  Marco Vettigli
// -----------------------------------------------------------------------------
//
// This program  is free software:  you can  redistribute it and/or  modify it
// under the terms of the  GNU General Public License as published by the Free
// Software Foundation,  either version 3 of the License,  or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY;  without even  the  implied  warranty  of  MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License  for
// more details.
//
// You  should  have received a copy of the  GNU General Public License  along
// with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// =============================================================================
//
// SROWPROPERTY.H
// The class defines a properties of a given row inside STable.
//
// Author: Marco Vettigli
//
// =============================================================================

#ifndef SROWPROPERTY_H
#define SROWPROPERTY_H

// == include directives =======================================================

#include <QColor>
#include <QPixmap>

// == class definitions ========================================================

namespace StatS {

class SRowProperty
{

public:

// == constructors and destructors =============================================

    // -- public ---------------------------------------------------------------
    // StatS::SRowProperty::SRowProperty()
    //
    // Default constructor for SRowProperty class.
    //
    // -------------------------------------------------------------------------
    SRowProperty();

// == enums ====================================================================

    // -- public ---------------------------------------------------------------
    // StatS::SRowProperty::RowMarker
    //
    // Row marker type enumeration.
    //
    // -------------------------------------------------------------------------
    enum RowMarker { Dot, Circle, Square, Triangle };

// == getters ==================================================================

    // -- public ---------------------------------------------------------------
    // StatS::SRowProperty::marker()
    //
    // Returns the marker type associated to the row.
    //
    // -------------------------------------------------------------------------
    RowMarker marker() const;

    // -- public ---------------------------------------------------------------
    // StatS::SRowProperty::size()
    //
    // Returns the size of marker associated to the row.
    //
    // -------------------------------------------------------------------------
    int size() const;

    // -- public ---------------------------------------------------------------
    // StatS::SRowProperty::width()
    //
    // Returns the width of marker associated to the row.
    //
    // -------------------------------------------------------------------------
    int width() const;

    // -- public ---------------------------------------------------------------
    // StatS::SRowProperty::color()
    //
    // Returns the color associated to the row.
    //
    // -------------------------------------------------------------------------
    QColor color() const;

// == setters ==================================================================

    // -- public ---------------------------------------------------------------
    // Stats::SRowProperty::setMarker(RowMarker)
    //
    // The function sets new row marker type given by 'marker'. If the 'marker'
    // value is not valid, false is returned. The 'marker' assignment must be
    // different from the current one.
    //
    // -------------------------------------------------------------------------
    bool setMarker(RowMarker marker);

    // -- public ---------------------------------------------------------------
    // Stats::SRowProperty::setSelected(bool)
    //
    // The function sets the selection state of the row. The assignment must be
    // different from the current one.
    //
    // -------------------------------------------------------------------------
    bool setSelected(bool state);

    // -- public ---------------------------------------------------------------
    // Stats::SRowProperty::setColor(QColor)
    //
    // The function sets new color ('color' variable) associated to the row.
    // The assignment must be different from the current one.
    //
    // -------------------------------------------------------------------------
    bool setColor(QColor color);

    // -- public ---------------------------------------------------------------
    // Stats::SRowProperty::setWidth(int)
    //
    // The function sets the width of the marker associated to the row. The
    // variable 'width' must be equal or greater than one and different from
    // the current one.
    //
    // -------------------------------------------------------------------------
    bool setWidth(int width);

    // -- public ---------------------------------------------------------------
    // Stats::SRowProperty::setSize(int)
    //
    // The function sets the size of the marker associated to the row. The
    // variable 'width' can be zero (not visible) but must be different from
    // the current one.
    //
    // -------------------------------------------------------------------------
    bool setSize(int size);

// == inspectors ===============================================================

    // -- public ---------------------------------------------------------------
    // StatS::SRowProperty::isSelected()
    //
    // Returns the selection state associated to the row.
    //
    // -------------------------------------------------------------------------
    bool isSelected() const;

// == accessor function declarations ===========================================

    // -- public ---------------------------------------------------------------
    // StatS::SRowProperty::getPixMap()
    //
    // The function returns a proper pixmap of the marker with current color,
    // width, size and selection state stored in the SRowProperty.
    //
    // -------------------------------------------------------------------------
    QPixmap getPixmap() const;

    // -- public ---------------------------------------------------------------
    // StatS::SRowProperty::getPixMap()
    //
    // The function returns a pixmap cointaing the current color.
    //
    // -------------------------------------------------------------------------
    QPixmap getColorPixmap();

// == variable declarations ====================================================

private:

    RowMarker _marker;              // marker type of the row
    bool _selectedState;            // selection state of the row

    QColor _color;                  // color of the row
    int _width;                     // width of the row
    int _size;                      // size of the row

// == private function declarations ============================================

};

}

#endif // SROWPROPERTY_H
